package main

import (
	"github.com/spf13/viper"
	"log"
)

func init() {
	log.Println("read config start")
	viper.SetConfigName("config")
	viper.SetConfigType("yaml")
	viper.AddConfigPath(".")
	err := viper.ReadInConfig()
	if err != nil {
		log.Fatal("read config failed: %v", err)
	}
}

func getConfig(key string) string {
	return viper.GetString(key)
}

func getConfigBypre(pre string, key string) string {
	return viper.GetString(pre + "." + key)
}
